/**
 *
 */
package com.guchenbo.example.encoding;

import java.io.UnsupportedEncodingException;

/**
 * @author Cre.Gu
 *
 */
public class Test {
	public static void main(String[] args) throws UnsupportedEncodingException, Exception {
		Test t = new Test();

		System.out.println(Integer.toBinaryString(39038));
		System.out.println(Integer.toBinaryString(-128&0xff));
		System.out.println(Integer.toBinaryString(-1));

		String s = "顾";
		byte[] bs = s.getBytes();

		for (int i = 0; i < bs.length; i++) {
			System.out.println(bs[i]);
		}

		Character c = '顾';
		System.out.println(Integer.toHexString(c));

		long l = 0x987el;
		long l2 = 0xffffl;

		System.out.println(l < l2);

		System.out.println(Integer.toHexString((int) '顾'));
		System.out.println(Integer.toHexString((int) '0'));
		System.out.println(Integer.toHexString((int) 'A'));
		System.out.println(Integer.toHexString((int) 'ع'));
		System.out.println(Integer.toHexString((int) '好'));
		System.out.println("\u0001d306");

		System.out.println(Utf8Utils.utf84UnicodeHex('顾'));
		System.out.println(Utf8Utils.utf84UnicodeHex('严'));

		// t.utf84Unicode(String.valueOf('顾'));
		char c1 = '顾';
		System.out.println(c1);

		String s1 = "多听FM";
		char[] cs = s1.toCharArray();
		for (char c2 : cs) {
			System.out.println((byte)c2);
			System.out.println(Integer.toHexString(c2) );
		}
		byte[] bs1 = s1.getBytes();
		System.out.println("getBytes()");
		for (byte b : bs1) {
			System.out.println(b);
		}
		byte[] bs2 = s1.getBytes("UTF-8");
		System.out.println("getBytes(UTF-8)");
		for (byte b : bs2) {
			System.out.println(b);
		}
		byte[] bs3 = s1.getBytes("ISO-8859-1");
		System.out.println("getBytes(ISO-8859-1)");
		for (byte b : bs3) {
			System.out.println(b);
		}
	}


}
